using System;
using Gtk;
using MagickConverter;
public partial class MainWindow: Gtk.Window
{	
	private bool InputFolderIsChoosen = false;
	private bool OutputFileIsChoosen = false;
	private AboutBox aboutbox;
	private string ConvertUrl;
	private string InputUrl;
	private string InputType;
	private string OutputUrl;
	private string OutputName;
	private string OutputType;
	private CommandGenerator StartCommand;
	public MainWindow (): base (Gtk.WindowType.Toplevel)
	{
		Build ();
	}
	
	protected void OnDeleteEvent (object sender, DeleteEventArgs a)
	{
		Application.Quit ();
		a.RetVal = true;
	}

	protected virtual void OnCheckChooseFolderClicked (object sender, System.EventArgs e)
	{
		if(InputFolderIsChoosen == false)
		{
		FilechooserInput.Action = FileChooserAction.SelectFolder;
			InputFolderIsChoosen = true;
		}
		else 
		{
			FilechooserInput.Action = FileChooserAction.Open;
			InputFolderIsChoosen = false;
		}
	}

	protected virtual void OnExitActionActivated (object sender, System.EventArgs e)
	{
		Application.Quit();
	}

	protected virtual void OnAboutActionActivated (object sender, System.EventArgs e)
	{
		aboutbox = new AboutBox();
		aboutbox.Show();
	}

	protected virtual void OnButtonConvertClicked (object sender, System.EventArgs e)
	{
		StartCommand = new CommandGenerator(ConvertUrl, InputUrl, InputType, OutputUrl, OutputName, OutputType);
		
		
	}

	protected virtual void OnFilechooserInputSelectionChanged (object sender, System.EventArgs e)
	{
		InputUrl = FilechooserInput.Filename;
		//InputType = FilechooserInput.filename
		LabelStatusOutput.Text = InputUrl;
		
	}
	
	protected virtual void OnFilechooserOutputSelectionChanged (object sender, System.EventArgs e)
	{
		OutputUrl = FilechooserOutput.Filename;
		LabelStatusOutput.Text = OutputUrl;
	}
}